package com.burst.reptile.common.utils;

import cn.hutool.core.util.StrUtil;
import cn.hutool.http.useragent.UserAgent;
import cn.hutool.http.useragent.UserAgentUtil;

public class UserAgentUtils extends UserAgentUtil {

	/**
	 * 用户的UA
	 * @return
	 */
	public static String getUa() {
		return ServletUtils.getRequest().getHeader("User-Agent");
	}
	
	/**
	 * 判断终端是否为移动终端
	 * @return
	 */
	public static boolean isMobile() {
		String uaStr = getUa();
		if(StrUtil.isNotEmpty(uaStr)) {
			UserAgent ua = UserAgentUtil.parse(getUa());
			return ua.isMobile();
		}
		return false;
	}
}
